package soft.quicknote;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.util.Log;


public class SettingFragment extends PreferenceFragment {
    private static final String TAG = SettingFragment.class.getSimpleName();

    public ListPreference fontSizeList;
    public Context mContext;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_general);
        fontSizeList = (ListPreference) findPreference("fontSize");
        fontSizeList.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                SharedPreferences.Editor editor = mContext.getSharedPreferences("quicknote", Context.MODE_PRIVATE).edit();
                editor.putString(fontSizeList.getKey(), (String) newValue);
                editor.commit();
                return false;
            }
        });
    }
}